﻿using Basic.FlowRemoteModel.Flow;
using Basic.FlowRemoteModel.Flow.Model;
using Basic.FlowService.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.Client.Interface;

namespace Basic.FlowService.RpcEvent
{
    internal class FlowEvent : IRpcApiService
    {
        private readonly IFlowService _Service;

        public FlowEvent ( IFlowService service )
        {
            this._Service = service;
        }
        public bool StopFlow(StopFlow obj)
        {
            return this._Service.Stop(obj.Id);
        }
        public void DeleteFlow ( DeleteFlow obj )
        {
            this._Service.Delete(obj.Id);
        }
        public string GetFlowName ( GetFlowName obj )
        {
            return this._Service.GetFlowName(obj.Id);
        }
        public FlowChildren GetChildrenFlow ( GetChildrenFlow obj )
        {
            return this._Service.GetChildren(obj.Id);
        }
        public long AddFlow ( AddFlow obj )
        {
            return this._Service.Add(obj.Datum);
        }
        public bool SetFlow ( SetFlow obj )
        {
            return this._Service.Set(obj.Id, obj.Datum);
        }
        public FlowDto GetFlow ( GetFlow obj )
        {
            return this._Service.Get(obj.Id);
        }
        public PagingResult<FlowData> QueryFlow ( QueryFlow obj )
        {
            return this._Service.Query(obj.Query, obj.ToBasicPage());
        }
    }
}
